package org.tuling.tlmallgateway01.config;

import org.springframework.cloud.gateway.filter.ratelimit.KeyResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import reactor.core.publisher.Mono;

//@Configuration
public class RateLimiterConfig {

    @Bean
    KeyResolver keyResolver() {
        //参数限流
        return exchange -> Mono.just(exchange.getRequest().getQueryParams().getFirst("userId"));
    }
}